from rest_framework import serializers
from rest_framework.serializers import ModelSerializer

from py_web.security.models import Role, Menu


class SaveOrUpdateRoleMenuSerializer(ModelSerializer):
    class Meta:
        model = Role
        fields = ('roleId','roleName', 'roleKey', 'roleSort', 'status', 'remark')


class GetMenuToMLAZ(ModelSerializer):
    value = serializers.CharField(source='menuId')
    leble = serializers.CharField(source='menuName')

    class Meta:
        model = Menu
        fields = ('menuId','menuName')
